import 'package:flutter/material.dart';

/// * 作者: Tao
/// * 日期: 2024/3/22
/// * 时间: 14:31
/// * 描述: 软键盘工具类
class KeyboardUtil {

  /// 隐藏键盘
  /// * [context] 上下文
  static hideKeyboard(BuildContext context) {
    var focusScopeNode = FocusScope.of(context);
    if (!focusScopeNode.hasPrimaryFocus && focusScopeNode.focusedChild != null) {
      FocusManager.instance.primaryFocus?.unfocus();
    }
  }
}